package cn.sinata.wanglin.mine.activity;
import android.os.Bundle;
import android.widget.TextView;

import com.xilada.xldutils.activitys.TitleActivity;

import butterknife.BindView;
import cn.sinata.wanglin.R;
import cn.sinata.wanglin.model.Myrepair;
import cn.sinata.wanglin.net.HttpManager;
import cn.sinata.wanglin.net.model.util.ResultDataSubscriber;
import cn.sinata.wanglin.utils.RelativeDateFormat;

public class MyrepairdetailActivity extends TitleActivity {
   private String mMyrepairId;
    @BindView(R.id.tv_createDate)
    TextView tv_createDate;//申请时间
    @BindView(R.id.tv_villagename)
    TextView tv_villagename;//小区名字
    @BindView(R.id.tv_project)
    TextView tv_project;//申请项目
    @BindView(R.id.tv_bespokeDate)
    TextView tv_bespokeDate;//预约时间
    @BindView(R.id.tv_remark)
    TextView tv_remark;//描述
    @Override
    protected int setContentId() {
        return R.layout.activity_myrepairdetail;
    }

    @Override
    protected void initView() {
        super.initView();
        setTitle("报修详情");
        Bundle mBundle=getIntent().getExtras();
        if(mBundle!=null){
            mMyrepairId= mBundle.getString("myrepair");
        }
        showDialog();
        getData();
    }
    public  void getData(){
        HttpManager.getRepairInfo(mMyrepairId).subscribe(new ResultDataSubscriber<Myrepair>(this) {
            @Override
            public void onSuccess(String msg, Myrepair myrepair) {
                tv_createDate.setText(RelativeDateFormat.getTimeYMDHMS(myrepair.getCreateDate()));
                tv_villagename.setText(myrepair.getHousingName());
                tv_project.setText(myrepair.getProject());
                tv_bespokeDate.setText(RelativeDateFormat.getTimeYMDHMS(myrepair.getBespokeDate()));
                tv_remark.setText(myrepair.getRemark());
            }
        });
    }
}
